package com.medicine.hbp.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.medicine.hbp.R;
import com.medicine.hbp.base.MyBaseAdapter;
import com.medicine.hbp.mob.findCareAboutVo;
import com.medicine.hbp.uitl.Share;

/**
 */
public class CareAboutAdapter extends MyBaseAdapter {
	private LayoutInflater inflater;
	public CareAboutAdapter(Activity activity) {
		this.activity = activity;
		inflater = LayoutInflater.from(activity);
	}

	@Override
	public View getView(int position, View view, ViewGroup arg2) {
		ViewHolder holder;
		if (view == null) {
			holder = new ViewHolder();
			view = inflater.inflate(R.layout.item_careabout, null);
			holder.care_about_date=(TextView) view.findViewById(R.id.care_about_date);
			holder.care_about_msg=(TextView) view.findViewById(R.id.care_about_msg);
			holder.btn_share=(ImageView) view.findViewById(R.id.btn_share);
			
			view.setTag(holder);
		} else {
			holder = (ViewHolder) view.getTag();
		}
		
		final findCareAboutVo vo=(findCareAboutVo) getItem(position);
		if(vo!=null){
			holder.care_about_date.setText(vo.careAboutDate);
			holder.care_about_msg.setText(vo.careAboutMsg);
			holder.btn_share.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View arg0) {
					Share.gxopenShare(activity,"����",vo.careAboutMsg,"");
					
				}
			});
		}
		return view;
	}

	class ViewHolder {
		TextView care_about_msg;
		TextView care_about_date;
		ImageView btn_share;
	}

}
